﻿using System;
using System.Diagnostics;
using System.Windows;
using TestRunner.Properties;

namespace TestRunner 
{
    static class Program 
    {
        [STAThread]
        public static void Main(string []args)
        {
            if (args.Length == 4 && String.Compare(args[0], TestDiscoveryHelper.DiscoverTestCommand, StringComparison.OrdinalIgnoreCase) == 0)
            {
                Trace.WriteLine(DateTime.Now + " Starting Test Discovery");
                TestDiscoveryHelper.FindTestsInAssemblyInternal(args[1], args[2], args[3]);
                Trace.WriteLine(DateTime.Now + " Finished Test Discovery");
            }
            else
            {
                try
                {
                    App app = new App();
                    app.InitializeComponent();
                    app.Run();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(Resources.UnExpectedError + Environment.NewLine + exception.Message, Resources.AppName, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
    }
}
